home *** CD-ROM | disk | FTP | other *** search
- /*
- ==============================================================================
-
- NPC_Surgeon - yup, an alien surgeon.
-
- ==============================================================================
- */
-
- #include "g_local.h"
- #include "npc_surgeon.h"
-
- static int sound_talk1;
- static int sound_talk2;
- static int sound_operate;
- static int sound_die;
-
- void npc_surgeon_operate (edict_t *self);
-
- void surgeon_talk(edict_t *self)
- {
- if(random() < 0.5)
- gi.sound (self, CHAN_VOICE, sound_talk1, 1 , ATTN_NORM, 0);
- else
- gi.sound (self, CHAN_VOICE, sound_talk2, 1, ATTN_NORM, 0);
- }
-
- void surgeon_operate_noise(edict_t *self)
- {
- gi.sound (self, CHAN_VOICE, sound_operate, 1, ATTN_NORM, 0);
- }
-
- mframe_t npc_surgeon_frames_examine[] =
- {
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, surgeon_talk,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL
-
- };
- mmove_t npc_surgeon_move_examine = {FRAME_examine01, FRAME_examine15, npc_surgeon_frames_examine, npc_surgeon_operate};
-
- void npc_surgeon_examine (edict_t *self)
- {
- if (random() < 0.2)
- self->monsterinfo.currentmove = &npc_surgeon_move_examine;
- }
-
- mframe_t npc_surgeon_frames_operate[] =
- {
- ai_move, 0, npc_surgeon_examine,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, surgeon_operate_noise,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL
-
- };
- mmove_t npc_surgeon_move_operate = {FRAME_operate01, FRAME_operate15, npc_surgeon_frames_operate, NULL};
-
- void npc_surgeon_operate (edict_t *self)
- {
- self->monsterinfo.currentmove = &npc_surgeon_move_operate;
- }
-
- void surgeon_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
- {
- int n;
-
- gi.sound (self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0);
-
- for (n = 0; n < 4; n++)
- {
- ThrowGib (self, "models/objects/gibs/mart_gut/tris.md2", damage, GIB_ORGANIC, EF_GREENGIB);
- ThrowHead (self, "models/objects/gibs/mart_head/tris.md2", damage, GIB_ORGANIC, EF_GREENGIB);
- }
-
- self->deadflag = DEAD_DEAD;
- }
-
- void SP_npc_surgeon (edict_t *self)
- {
- if (deathmatch->value)
- {
- G_FreeEdict (self);
- return;
- }
-
- // pre-caches
-
- sound_talk1 = gi.soundindex ("martian/ack2.wav");
- sound_talk2 = gi.soundindex ("martian/ack3.wav");
- sound_operate = gi.soundindex ("martian/operate.wav");
- sound_die = gi.soundindex("martian/death.wav");
-
- self->s.modelindex = gi.modelindex("models/npc/martian_surgeon/tris.md2");
-
- VectorSet (self->mins, -8, -8, -26);
- VectorSet (self->maxs, 8, 8, 48); // small so he can get up to the table
- self->movetype = MOVETYPE_STEP;
- self->solid = SOLID_BBOX;
- self->s.skinnum = 0;
-
- self->max_health = 150;
- self->health = self->max_health;
- self->gib_health = 0;
- self->mass = 100;
-
- self->pain = NULL;
- self->die = surgeon_die;
-
- self->monsterinfo.stand = npc_surgeon_operate;
- self->monsterinfo.walk = npc_surgeon_operate;
- self->monsterinfo.run = npc_surgeon_operate;
- self->monsterinfo.dodge = NULL;
- self->monsterinfo.attack = NULL;
- self->monsterinfo.melee = NULL;
- self->monsterinfo.sight = NULL;
- self->monsterinfo.search = NULL;
-
- self->monsterinfo.currentmove = &npc_surgeon_move_operate;
- self->monsterinfo.scale = MODEL_SCALE;
-
- gi.linkentity (self);
-
- walkmonster_start (self);
- }
-